<template>
  <div>
    <div>
      <!-- <el-button v-if="!showDisabled" type="text" size="medium" icon="el-icon-circle-plus-outline" @click="openAddDialog('editForm')">新增客户决策链分析(请按照客户影响程度进行排序)</el-button> -->
      <el-popover style="display:block" placement="top-start" width="260" trigger="hover" content="请按照客户影响程度进行排序">
        <el-button type="text" slot="reference" size="medium" icon="el-icon-circle-plus-outline" @click="openAddDialog('editForm')">新增客户决策链分析</el-button>
      </el-popover>
    </div>
    <!--表格渲染-->
    <el-table class="tl-table" ref="mainTable" height="200px" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
      <el-table-column prop="post" label="部门职务" width="300px" sortable="custom" sort-by="post" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
      <el-table-column prop="dispcustomerlevel" label="客户关系等级" width="190px" sortable="custom" sort-by="customerlevel" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
      <el-table-column prop="dispcustomerapproval" label="任务支持程度" width="190px" sortable="custom" sort-by="customerapproval" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
      <el-table-column v-if="!showDisabled" label="操作" width="200px" v-slot="scope" fixed="right">
        <el-button type="text" icon="el-icon-edit" @click="openEditDialog('editForm', scope.row.id)">编辑</el-button>
        <!-- <el-button type="text" icon="el-icon-view" @click="openViewDialog('editForm', scope.row.id)">查看</el-button> -->
        <el-button type="text" icon="el-icon-delete" @click="doDelete(scope.row.id)">删除</el-button>
      </el-table-column>
    </el-table>
    <tl-edit ref="editForm" @refresh="doRefresh" :parentId="parentId" :taskId="taskId" :showDisabled="showDisabled"></tl-edit>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import tlEdit from './editForCustomerTask'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'mpmCustomerAnalysis',
  mixins: [mixin_list],
  components: { tlEdit },
  data() {
    return {
      description: '项目策划-客户决策链分析-列表查询',
      urlPrefix: '/mpm/customerAnalysis/',
      url: {
        // queryCodeList: '/mpm/customerAnalysis/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'sortcode',
        sord: 'asc, MPMCUSTOMERANALYSIS.customerlevel asc'
      },
      // 分页参数
      pageInfo: {
        currentPage: 1,
        pageSize: 2000
      }
    }
  },
  props: {
    parentId: {
      type: [Number, String],
      default: ''
    },
    showDisabled: {
      type: Boolean,
      default: false
    },
    planstate: {
      type: Number
    },
    taskId: {
      type: [Number, String],
      default: ''
    },
    customerTask: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  watch: {
    customerTask: function (oldV, newV) {
      this.doQuery()
    }
  },
  methods: {
    beforeLoadData() {
      if (!this.taskId) {
        return false
      }
      this.queryParam.qry_taskid = this.taskId
      return true
    }
  }
}
</script>

<style lang="scss" scoped>
/** 表格样式相关 */
.tl-table {
  /** “暂无数据”居中显示 */
  /deep/ .el-table__empty-block {
    justify-content: center;
    align-items: center;
    padding: 0;
  }
  /deep/ .el-table__empty-text {
    text-align: center;
  }
  // 控制边框
  /deep/ .gutter {
    display: none !important;
  }
}
</style>
